// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property(cc.Button)
    delete_self: cc.Button = null

    delete(event:cc.Event.EventTouch){
        let a = window["Win_Global"];
        let id = this.node.getComponent('WordTemplate').getId();
        console.log(id)
        a.delete(id);
        console.log("remove all child"+this.node)
        this.node.destroy()
    }

    onLoad () {
        this.delete_self.node.on(cc.Node.EventType.TOUCH_END, this.delete,this);
    }

    start () {

    }

    // update (dt) {}
}
